import Vue from "vue";
import VueRouter from "vue-router";
import Login from "@/views/login"
import Layout from "@/views/layout"
import Home from "@/views/home"
import My from "@/views/my"
import Question from "@/views/question"
import Video from "@/views/video"

Vue.use(VueRouter);

const routes = [
  {
    path: "/login",
    component:Login
  },
  {
    path: "/",
    component: Layout,
    // 重定向，默认渲染首页
    redirect:"/home",
    children: [
      {
        // 默认渲染这个子路由
        path: "/home",
        component:Home
      },
      {
        path: "/question",
        component:Question
      }, {
        path: "/video",
        component:Video
      }, {
        path: "/my",
        component:My
      },
    ]
  }
];

const router = new VueRouter({
  routes,
});

export default router;
